package com.example.spring.controller;

import com.example.spring.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class TestController {

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    @ResponseBody
    private List<User> test() {
        User user = null;

        List<User> list = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            user = new User(String.format("张三%d", i), 18, 100);
            list.add(user);
        }

        return list;
    }
}
